// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * at91sam9x5ek.dtsi - Device Tree file for AT91SAM9x5CM Base board
 *
 *  Copyright (C) 2012 Atmel,
 *                2012 Nicolas Ferre <nicolas.ferre@atmel.com>
 */
#include "at91sam9x5cm.dtsi"

/ {
	model = "Atmel AT91SAM9X5-EK";
	compatible = "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";

	chosen {
		bootargs = "root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs";
		stdout-path = "serial0:115200n8";
	};

	sound {
		compatible = "atmel,sam9x5-wm8731-audio";

		atmel,model = "wm8731 @ AT91SAM9X5EK";

		atmel,audio-routing =
			"Headphone Jack", "RHPOUT",
			"Headphone Jack", "LHPOUT",
			"LLINEIN", "Line In Jack",
			"RLINEIN", "Line In Jack";

		atmel,ssc-controller = <&ssc0>;
		atmel,audio-codec = <&wm8731>;
	};
};

&adc0 {
	atmel,adc-ts-wires = <4>;
	atmel,adc-ts-pressure-threshold = <10000>;
	status = "okay";
};

&dbgu {
	status = "okay";
};

&i2c0 {
	status = "okay";

	wm8731: wm8731@1a {
		compatible = "wm8731";
		reg = <0x1a>;
	};
};

&mmc0 {
	pinctrl-0 = <
		&pinctrl_board_mmc0
		&pinctrl_mmc0_slot0_clk_cmd_dat0
		&pinctrl_mmc0_slot0_dat1_3>;
	status = "okay";

	slot@0 {
		reg = <0>;
		bus-width = <4>;
		cd-gpios = <&pioD 15 GPIO_ACTIVE_HIGH>;
	};
};

&mmc1 {
	pinctrl-0 = <
		&pinctrl_board_mmc1
		&pinctrl_mmc1_slot0_clk_cmd_dat0
		&pinctrl_mmc1_slot0_dat1_3>;
	status = "okay";

	slot@0 {
		reg = <0>;
		bus-width = <4>;
		cd-gpios = <&pioD 14 GPIO_ACTIVE_HIGH>;
	};
};

&pinctrl {
	camera_sensor {
		pinctrl_pck0_as_isi_mck: pck0_as_isi_mck-0 {
			atmel,pins =
				<AT91_PIOC 15 AT91_PERIPH_C AT91_PINCTRL_NONE>;	/* ISI_MCK */
		};

		pinctrl_sensor_power: sensor_power-0 {
			atmel,pins =
				<AT91_PIOA 13 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
		};

		pinctrl_sensor_reset: sensor_reset-0 {
			atmel,pins =
				<AT91_PIOA 7 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
		};
	};

	mmc0 {
		pinctrl_board_mmc0: mmc0-board {
			atmel,pins =
				<AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;	/* PD15 gpio CD pin pull up and deglitch */
		};
	};

	mmc1 {
		pinctrl_board_mmc1: mmc1-board {
			atmel,pins =
				<AT91_PIOD 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;	/* PD14 gpio CD pin pull up and deglitch */
		};
	};

	usb2 {
		pinctrl_board_usb2: usb2-board {
			atmel,pins =
				<AT91_PIOB 16 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>;		/* PB16 gpio vbus sense, deglitch */
		};
	};
};

&spi0 {
	cs-gpios = <&pioA 14 0>, <0>, <0>, <0>;
	status = "disabled"; /* conflicts with mmc1 */

	m25p80@0 {
		compatible = "atmel,at25df321a";
		spi-max-frequency = <50000000>;
		reg = <0>;
	};
};

&ssc0 {
	status = "okay";
};

&usart0 {
	atmel,use-dma-rx;
	atmel,use-dma-tx;
	status = "okay";
};

&usb0 {
	num-ports = <3>;
	atmel,vbus-gpio = <0 /* &pioD 18 GPIO_ACTIVE_LOW *//* Activate to have access to port A */
			   &pioD 19 GPIO_ACTIVE_LOW
			   &pioD 20 GPIO_ACTIVE_LOW
			  >;
	status = "okay";
};

&usb1 {
	status = "okay";
};

&usb2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_board_usb2>;
	atmel,vbus-gpio = <&pioB 16 GPIO_ACTIVE_HIGH>;
	status = "okay";
};

&watchdog {
	status = "okay";
};
